package com.fedming.bottomnavigationdemo.Adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.fedming.bottomnavigationdemo.R;

import java.util.List;

public class DoctorAdviceRecycleViewAdapter extends RecyclerView.Adapter<DoctorAdviceRecycleViewAdapter.ViewHolder> {
    private List<String> mAdviceList;//数据源

    public DoctorAdviceRecycleViewAdapter(List<String> list) {
        mAdviceList = list;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.doctor_advice_recycle_item, parent, false);
        final ViewHolder holder = new ViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        String doctoradvice = mAdviceList.get(position);
        holder.content.setText(doctoradvice);

    }

    @Override
    public int getItemCount() {
        return mAdviceList.size();
    }

    static class ViewHolder extends RecyclerView.ViewHolder {
        TextView content;
        public ViewHolder(View view) {
            super(view);
            content = (TextView) view.findViewById(R.id.advice_content);
        }

    }



}
